<template>
    <el-container>
      <el-header>
        <HeaderComponent />
      </el-header>
      <el-main class="el-main-container">
        <div class="loginbox">
          <div class="jarallax-bg"></div>
        </div>
        <section class="contact-us py-5 my-5">
          <el-row :gutter="20">
            <el-col :span="12">
              <div class="contact-info pb-3">
                <p>Tortor dignissim convallis aenean et tortor at risus viverra adipiscing.</p>
                <el-row :gutter="20">
                  <el-col :span="12">
                    <div class="content-box text-dark pe-4 mb-5">
                      <h3 class="card-title">Office</h3>
                      <div class="contact-address pt-3">
                        <p>730 Glenstone Ave 65802, Springfield, US</p>
                      </div>
                      <div class="contact-number">
                        <p><a href="#" class="black-text">+123 987 321</a></p>
                        <p><a href="#" class="black-text">+123 123 654</a></p>
                      </div>
                      <div class="email-address">
                        <p><a href="#" class="black-text">contact@website.com</a></p>
                      </div>
                    </div>
                  </el-col>
                  <el-col :span="12">
                    <div class="content-box">
                      <h3 class="card-title">Management</h3>
                      <div class="contact-address pt-3">
                        <p>730 Glenstone Ave 65802, Springfield, US</p>
                      </div>
                      <div class="contact-number">
                        <p><a href="#" class="black-text">+123 987 321</a></p>
                        <p><a href="#" class="black-text">+123 123 654</a></p>
                      </div>
                      <div class="email-address">
                        <p><a href="#" class="black-text">contact@website.com</a></p>
                      </div>
                    </div>
                  </el-col>
                </el-row>
                <div class="social-links mt-3">
                  <el-button type="plain" icon="el-icon-share" circle></el-button>
                  <el-button type="plain" icon="el-icon-share" circle></el-button>
                  <el-button type="plain" icon="el-icon-share" circle></el-button>
                  <el-button type="plain" icon="el-icon-share" circle></el-button>
                  <el-button type="plain" icon="el-icon-share" circle></el-button>
                </div>
              </div>
            </el-col>
            <el-col :span="12">
              <div class="inquiry-item">
                <h2>取得联系</h2>
                <p class="mb-4">使用下面的表格与我们联系。</p>
                <el-form>
                  <el-form-item>
                    <el-input v-model="contactName" placeholder="在这里写下你的名字"></el-input>
                  </el-form-item>
                  <el-form-item>
                    <el-input v-model="contactEmail" placeholder="在这里写下你的电子邮件"></el-input>
                  </el-form-item>
                  <el-form-item >
                    <el-input v-model="contactPhone" placeholder="电话号码"></el-input>
                  </el-form-item>
                  <el-form-item >
                    <el-input v-model="contactTitle" placeholder="在这里写下你的主题"></el-input>
                  </el-form-item>
                  <el-form-item >
                    <el-input type="textarea" v-model="contactMessage" :rows="5"  placeholder="在这里写下你的留言"></el-input>
                  </el-form-item>
                  <el-form-item>
                    <el-button type="primary" @click="onSubmit()" class="custom-submit-button">提交</el-button>
                  </el-form-item>
                </el-form>
              </div>
            </el-col>
        </el-row>
        </section>
      </el-main>
      <el-footer>
        <FooterComponent />
      </el-footer>
    </el-container>
  </template>
  
  <script>
  import { insertcontact } from '@/api/api';
  
  export default {
    name: 'contact',
    components: {
      HeaderComponent: () => import('@/pages/header.vue'),
      FooterComponent: () => import('@/pages/demo.vue')
    },
    data() {
      return {
        contactName: '',
        contactEmail: '',
        contactPhone: '',
        contactTitle: '',
        contactMessage: ''
      }
    },
    methods: {
      onSubmit() {
        insertcontact(this.contactName,this.contactEmail,this.contactPhone,this.contactTitle,this.contactMessage).then(res=>{
          console.log(res);
          if(res.data>0){
            this.$message.success("提交成功,请耐心等待")
            this.$router.go(0);
          }else{
            this.$message.error("提交失败，请重新输入")
            tthis.$router.go(0);
          }
        })
      }
    }
  }
  </script>
  
  <style scoped>
  .el-main-container {
    margin: 0;
    padding: 0;
  }
  
  html {
    margin: 0;
    padding: 0;
  }
  
  .loginbox {
    width: 100%;
    height: 300px;
    background-color: #f4d16e;
    background-image: url(../images/banner-1.jpg);
    background-repeat: no-repeat;
    background-size: cover;
    margin: 0 auto;
  }
  
  .jarallax-bg {
    width: 1600px;
    height: 300px;
  }
  
  .contact-us {
    background-color:white;
    padding: 5rem 0;
  }
  
  .contact-info {
    background-color: #fff;
    padding: 2rem;
  }
  
  .content-box {
    margin-bottom: 1rem;
  }
  
  .card-title {
    font-size: 1.5rem;
    margin-bottom: 1rem;
  }
  
  .contact-address,
  .contact-number,
  .email-address {
    margin-bottom: 1rem;
  }
  
  .social-links .el-button {
    margin-right: 0.5rem;
  }
  
  .inquiry-item {
    background-color: #fff;
    padding: 2rem;
  }
  
  .el-form-item__label {
    font-weight: bold;
  }
  
  .el-form-item__content {
    margin-left: 0 !important;
  }
  .mb-4{
    margin-top: 10px;
    margin-bottom: 20px;
  }
  .black-text {
    color: black;
  }
  .custom-submit-button {
  width: 100%;
  height: 50px;
  border-radius: 10px;
  background-color: #6BB252;
  transition: background-color 0.3s ease;
}

.custom-submit-button:hover {
  background-color: #F7A422; /* 悬停时的颜色 */
}
  </style>